package com.learn.bean;

import jakarta.annotation.Resource;
import jakarta.annotation.Resources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2024/11/27
 * @description
 */
@Component
public class Person {
    @Value("morales")
    private String name;
    private User friend;

    public Person() {
    }
    @Resource(name = "user")
    public void setFriend(User friend) {
        this.friend = friend;
    }

    public Person(String name, User friend) {
        this.name = name;
        this.friend = friend;
    }
    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", friend=" + friend +
                '}';
    }
}
